import zipfile
import os

zip_file_path ="D:\\SmartAccelerator\\20210303.zip"
zip_files = zipfile.ZipFile(zip_file_path,mode='r')

def print_info():
    # 获取zip压缩文件的相关信息
    for content in zip_files.infolist():
        print(content)


def print_name():
    for name in zip_files.namelist():
        print(name)


def extract_all():
    unzip_dir = "D:\\SmartAccelerator\\"
    #unzip_files = zipfile.ZipFile(zip_file2_path, mode='r', compression=zipfile.ZIP_DEFLATED)
    zip_files.extractall(unzip_dir)

def zip_file():
    file_names = os.listdir("E:\\data_bridge\\temp\\")
    zf = zipfile.ZipFile("E:\\aaaa.zip", mode="w", compression=zipfile.ZIP_DEFLATED)
    for file_name in file_names:
        zf.write(f"E:\\data_bridge\\temp\\{file_name}", arcname="aaa"+file_name)
    zf.close()

if __name__ == '__main__':
    #print_name()
    #print_info()
    #extract_all()
    zip_file()
